﻿@{
    ViewBag.Title = "配送地址管理";
    Layout = "~/Views/Shared/_layoutPersonal.cshtml";
}
@Styles.Render("~/Content/css/addressManage")

<article class="main">
    <nav class="mod_nav">
        <div class="lay_left">
            <a class="nav_back" onclick="turnBack()"><img src="/images/TurnBackNormal.png"></a>
            <span>配送地址管理</span>
        </div>
        <div class="lay_right">
            <a class="btn_send" value="1"><img src="/images/DeliveryAddrDelBtn.png"></a>
        </div>
    </nav>

    <section class="mod_btn">
        <a class="btn_add" onclick="addAddress()">新增地址</a>
    </section>

    <section id="GetDeliveryAddressList" class="addressList">
    </section>

</article>

<script>
    window.onload = function () {
        DeliveryAddrMgr.loadDeliveryListAddr(showDeliveryAddrList);
    }

    function showDeliveryAddrList(deliveryAddrList, defIndex) {
        var redirectUrl = "@ViewBag.redirectUrl";
        var url = '@Url.Content("~/")' + 'DeliveryAddr/GetDeliveryAddressList';
        var json = { "deliveryAddressList": deliveryAddrList, "defaultDeliveryAddressIndex": defIndex, "redirectUrl": redirectUrl };
        NativeAjax(json, url, function (msg) {
            loadPartialViewResult(msg, $("#GetDeliveryAddressList"), 1);
        });
    }

    function turnBack() {
        window.location.href = '@Url.Content("~/")' + 'User/Index';
    }

    function addAddress() {
        window.location.href = '@Url.Content("~/")' + 'DeliveryAddr/Add';
    }
</script>
